package com.westos.service;

import com.westos.dao.CustomerDao;
import com.westos.domain.Customer;
import com.westos.utils.UUIDUtils;

import java.util.List;

/**
 * @Author: ShenMouMou
 * @CreateTime: 2019-12-27 14:04
 * @Company:西部开源教育科技有限公司
 * @Description:爱生活，爱Java!
 */
public class CustomerService {
    private CustomerDao dao;

    public CustomerDao getDao() {
        return dao;
    }

    public void setDao(CustomerDao dao) {
        this.dao = dao;
    }

    public List<Customer> findAll() throws Exception {
       List<Customer> customerList= this.dao.findAllCustomer();
       return customerList;
    }

    public boolean addCustomer(Customer customer) throws Exception {
        customer.setCid(UUIDUtils.getUUID());
       boolean b= this.dao.addCustomer(customer);
       return b;
    }

    public boolean delCustomer(String cid) throws Exception {
        boolean b = this.dao.delCustomer(cid);
        return b;
    }

    public boolean delMoreCustomer(String[] item_checkboxes) throws Exception {
       boolean b= this.dao.delAllCustomer(item_checkboxes);
       return b;
    }
}
